class Solution(object):
    def deleteDuplicates(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """
        #空或者只有一个节点
        if head is None or head.next is None:
            return head
        dummyHead = ListNode()
        dummyHead.next = head
        cur = dummyHead
        while cur != None:
            tmp = cur.next
            while tmp != None and tmp.next != None and tmp.val == tmp.next.val:
                tmp = tmp.next
            cur.next = tmp
            cur = tmp
        return dummyHead.next
